import React from "react";
import withRouter from 'umi/withRouter';
import Link from "umi/link";
import style from './index.less';
import Block from './components/Block'
import Transactions from './components/Transactions'
import {connect} from 'react-redux';

class BlockDetail extends React.Component {
  componentDidMount() {
    document.documentElement.scrollTo(0, 0);
  }

  render() {
    return (
      <div className={style.container}>
        <div className={style.nav}>
          <Link to="/">首页</Link> / 序列块-{this.props.data.hash}
        </div>
        <div className={style.blockInfo}>
          <Block data={this.props.data}/>
        </div>
        <div className={style.transactionInfo}>
          <Transactions hash={this.props.data.hash}/>
        </div>
        <div className={style.footer}>
        </div>
      </div>
    );
  }
}

function mapStateToProps(state) {
  const { data } = state.block;
  return {
    data,
  };
}

export default connect(mapStateToProps)(withRouter(BlockDetail));


